<?php

namespace Apps\Common\Models;

/**
 * 平台操作员操作日志Model
 * @author     chenxiaolin
 * @date        2016年1月19日
 * @version     2.0.0
 * @copyright   Copyright 2016 meelier.com
 */
class BackendOperatorLog extends \PhalconPlus\Database\Model
{

    /**
     *
     * @var integer
     */
    public $log_id;

    /**
     *
     * @var integer
     */
    public $operator_id;

    /**
     *
     * @var integer
     */
    public $log_type;

    /**
     *
     * @var string
     */
    public $log_content;

    /**
     *
     * @var string
     */
    public $log_client_info;

    /**
     *
     * @var string
     */
    public $log_addtime;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->belongsTo('operator_id', 'Apps\Common\Models\BackendOperator', 'operator_id', array('alias' => 'BackendOperator'));
        $this->belongsTo('log_type', 'Apps\Common\Models\BackendOperatorLogType', 'type_id', array('alias' => 'BackendOperatorLogType'));
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'backend_operator_log';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return BackendOperatorLog[]
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return BackendOperatorLog
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }

    /**
     * Independent Column Mapping.
     * Keys are the real names in the table and the values their names in the application
     *
     * @return array
     */
    public function columnMap()
    {
        return array(
            'log_id' => 'log_id',
            'operator_id' => 'operator_id',
            'log_type' => 'log_type',
            'log_content' => 'log_content',
            'log_client_info' => 'log_client_info',
            'log_addtime' => 'log_addtime'
        );
    }

    public function defaultColumns()
    {
        return [
            'log_addtime',
        ];
    }
}
